<div class="layui-form" style="padding: 20px 0 0 0;">
  <script type="text/html" template>
    <input type="hidden" name="id" value="{{ d.params.id || 0 }}">
    </script>
  <div class="layui-form-item">
    <label class="layui-form-label">所属分类</label>
    <div class="layui-input-inline">
      <script type="text/html" template lay-url="/category/list?type=1" lay-done="layui.form.render();">
        <select name="category_id">
          <option value="0" {{# if(d.params.category_id == 0){ }}selected{{# } }}>无分类</option>
          {{#  layui.each(d.data, function(index, item){ }}
          <option value="{{ item.id }}" {{# if(d.params.category_id == item.id){ }}selected{{# } }}>{{ item.spacer || '' }}{{ item.title }}</option>
          {{# }) }}
        </select>
      </script>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">文章标题</label>
    <div class="layui-input-block">
      <script type="text/html" template>
      <input type="text" name="title" value="{{ d.params.title || '' }}"  lay-verify="required" placeholder="请输入...(必填)" autocomplete="off" class="layui-input">
    </script>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">文章关键词</label>
    <div class="layui-input-block layui-flex">
      <script type="text/html" template>
        <input type="text" name="keywords" value="{{ d.params.keywords || '' }}" id="keywords" autocomplete="off" class="layui-input flex-item">
      </script>
      <a href="javascript:;" class="layui-btn layui-btn-primary" id="select-keywords" data-for="keywords">选择关键词</a>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">文章描述</label>
    <div class="layui-input-block">
      <script type="text/html" template>
      <textarea class="layui-textarea" name="description" rows="3">{{ d.params.description || '' }}</textarea>
      </script>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">文章模板</label>
    <div class="layui-input-inline">
      <script type="text/html" template>
        <input type="text" name="template" value="{{ d.params.template || '' }}" placeholder="自定义文章详情模板，默认继承分类设置" autocomplete="off" class="layui-input">
      </script>
    </div>
    <div class="layui-form-mid layui-word-aux">默认值：article/detail.html</div>
  </div>
  <div class="layui-collapse" style="margin-bottom: 20px;">
    <div class="layui-colla-item">
      <h2 class="layui-colla-title">附加参数</h2>
      <div class="layui-colla-content layui-show">
        <script type="text/html" template lay-url="/article/setting" lay-done="layui.form.render();">
          <div class="layui-row">
            {{#  layui.each(d.data.fields, function(index, item){ }}
            <div class="layui-col-sm6">
              <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">{{item.name}}</label>
                <div class="layui-input-block">
                  {{# if(item.type == "text" || item.type == "number"){  }}
                      <input type="{{item.type}}" name="extra[{{item.field_name}}]" value="{{d.params.extra[item.field_name]?.value || ''}}" {{# if(item.required){ }}required lay-verify="required"{{# } }} placeholder="{{item.content}}" autocomplete="off" class="layui-input">
                      {{# }else if(item.type == "textarea"){ }}
                      <textarea class="layui-textarea" name="extra[{{item.field_name}}]" {{# if(item.required){ }}required lay-verify="required"{{# } }} placeholder="{{item.content}}" rows="3">{{d.params.extra[item.field_name]?.value || ''}}</textarea>
                      {{# }else if(item.type == "radio"){ }}
                      {{# for(let val of layui.util.splitln(item.content)){ }}
                      <input type="{{item.type}}" name="extra[{{item.field_name}}]" value="{{val}}" title="{{val}}" {{# if(d.params.extra[item.field_name]?.value == val){ }}checked{{# } }}>
                      {{# } }}
                      {{# }else if(item.type == "checkbox"){ }}
                      {{# for(let val of layui.util.splitln(item.content)){ }}
                      <input type="{{item.type}}" name="extra[{{item.field_name}}][]" value="{{val}}" title="{{val}}" {{# if(layui.util.inArray(d.params.extra[item.field_name]?.value, val)){ }}checked{{# } }}>
                      {{# } }}
                      {{# }else if(item.type == "select"){ }}
                      <select name="extra[{{item.field_name}}]">
                          {{# for(let val of layui.util.splitln(item.content)){ }}
                          <option value="{{val}}" {{# if(d.params.extra[item.field_name]?.value == val){ }}selected{{# } }}>{{val}}</option>
                          {{# } }}
                      </select>
                      {{# } }}
                </div>
              </div>
            </div>
            {{# }) }}
          </div>
        </script>
      </div>
    </div>
  </div>
  <div class="layui-form-item">
    <script type="text/html" template>
      <textarea class="layui-textarea" id="text-editor" name="content" rows="30">{{ d.params.data && d.params.data.content || '' }}</textarea>
    </script>
  </div>
  <div class="layui-collapse" style="margin-bottom: 20px;">
    <div class="layui-colla-item">
      <h2 class="layui-colla-title">添加素材 <small style="padding-left: 20px;color: #b58500">使用说明：点击素材内容即可进入编辑器。</small></h2>
      <div class="layui-colla-content">
        <div class="material-categories"></div>
        <div class="material-list">
          <table id="material-list" lay-filter="material-list" data-type="default"></table>
          <script type="text/html" id="table-material-toolbar">
            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="use"><i class="layui-icon layui-icon-addition"></i>使用</a>
            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view"><i class="layui-icon layui-icon-search"></i>预览</a>
          </script>
        </div>
      </div>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label"></label>
    <div class="layui-input-inline">
      <input type="button" lay-submit lay-filter="article-submit" value="确认" class="layui-btn">
    </div>
  </div>
</div>